Hey, I've been migrating to minizinc recently. While working with models for potentially preemptive scheduling for the job-shop problem I was surprised that the model almost always seems to ignore the disjunctive constraint, even with no preemption. I have tried the following strategies: Given an array of fixed size n of tasks along with an array containing the group (machine) it belongs, to avoid overlapping in a same group (machine), we can formulate the following constraint
constraint forall(p1, p2 in 1..num_parts, i, j in 1..num_group_tasks where (i < j) /\ (group[i] = group[j])) (
(end[group_task[i], p1] <= start[group_task[j], p2]) \/ (end[group_task[j], p2] <= start[group_task[i], p1])
);
or, by using scheduling-specific predicates,
constraint forall(g in 1..num_groups) (
disjunctive([start[group_task[i], 1] | p in 1..num_parts, i in 1..num_group_tasks where group[i] == g],
[duration[group_task[i], 1] | p in 1..num_parts, i in 1..num_group_tasks where group[i] == g])
);
However, any of these seems to be working properly, except sometimes when the tasks are sorted by processing times (working_example.dzn is the only instance that yields non-overlaping tasks). I use a python code to plot a Gantt chart along with the output to check for overlapping tasks more easily:
minizinc --solver cplex model.mzn data.dzn --output-mode json --soln-sep "" --search-complete-msg "" | python gantt.py
I can't find where my model is mistaken, or if I'm doing something wrong in the process. Any ideas on what is possibly broken?
Thank you in advance,
Daniel
PS: After some testing, I found out that ortools correctly behaves, in opposite to cplex and gurobi, when using the disjunctive predicate, isn't it well-defined in cplex and gurobi? Why do they keep ignoring them?